Multiple word searches: "context unavailable" [fix]
Is this package even being maintained??
Mutliple prhase searches can give the annoying "context unavailable" text. this is a malfunction in the c# code XSLTsearch uses.
fix:
//bad with bug
public int indexOfMany(string search, string[] find){
int foundIndex = search.Length;
foreach(string toFind in find)
foundIndex = Math.Min(foundIndex, search.ToUpper().IndexOf(toFind.ToUpper()));
return foundIndex;
}
//good :) no bugs
public int indexOfMany(string search, string[] find){
int foundIndex = search.Length;
bool found = false;
foreach(string toFind in find)
{
int res = search.ToUpper().IndexOf(toFind.ToUpper());
if(res != -1){
found = true;
foundIndex = Math.Min(foundIndex, res);
}
}
if(!found)return -1;
return foundIndex;
}
Multiple word searches: "context unavailable" [fix]
Is this package even being maintained??
Mutliple prhase searches can give the annoying "context unavailable" text. this is a malfunction in the c# code XSLTsearch uses.
fix:
Thanks, Niels! Nice catch.
I've just added your update to the source of the project. You'll see it in a new release of XSLTsearch soon.
cheers,
doug.
is working on a reply...